import {onBeforeUnmount, onMounted, shallowRef} from 'vue'
export default function () {
    const chart = shallowRef(null ) 
    // 刷新 echart
    const chartResizeHandler = () => {
        if (chart.value) {
          chart.value.resize()
        }
      }

	onMounted(()=>{
		window.addEventListener('resize', chartResizeHandler)
	}) 
  onBeforeUnmount(() => {
    window.removeEventListener('resize', chartResizeHandler)
  })
	return {
		chart
	}
}
